package mapEditor.vo
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	
	import utils.DisplayUtil;

	public class MapVO extends EventDispatcher
	{
		/**
		 *地图文件路径 
		 */		
		private var _mapFilePath:String;
		/**
		 *地图文件目录 
		 */		
		private var _mapFileDir:String;
		private var _mapRow:int=4;
		private var _mapCols:int=4;
		private var _tileSize:int=30;
		/**
		 *最大跨越通行地形高度 
		 */		
		private var _walkableHeight:int=10;
		/**
		 *最大穿越通行地形高度  
		 */		
		private var _walkableBottom:int=40;
		private var _terrainTileList:Vector.<MapTerrainTileVO>=new Vector.<MapTerrainTileVO>();
		
		public function MapVO()
		{
		}

		public function get mapRow():int
		{
			return _mapRow;
		}

		public function set mapRow(value:int):void
		{
			_mapRow = value;
		}

		public function get mapCols():int
		{
			return _mapCols;
		}

		public function set mapCols(value:int):void
		{
			_mapCols = value;
		}

		public function get tileSize():int
		{
			return _tileSize;
		}

		public function set tileSize(value:int):void
		{
			_tileSize = value;
		}

		/**
		 *地图文件路径
		 */
		public function get mapFilePath():String
		{
			return _mapFilePath;
		}

		/**
		 * @private
		 */
		public function set mapFilePath(value:String):void
		{
			_mapFilePath = value;
			_mapFileDir=_mapFilePath.slice(0,_mapFilePath.lastIndexOf("\\"));
		}

		/**
		 *地图文件目录
		 */
		public function get mapFileDir():String
		{
			return _mapFileDir;
		}

		/**
		 * @private
		 */
		public function set mapFileDir(value:String):void
		{
			_mapFileDir = value;
		}
		
		public function change():void
		{
			dispatchEvent(new Event(Event.CHANGE));
		}
		
		public function dispose():void
		{
			while(_terrainTileList && _terrainTileList.length>0)
			{
				DisplayUtil.dispose(_terrainTileList.shift());
			}
			_terrainTileList=null;
		}

		public function get terrainTileList():Vector.<MapTerrainTileVO>
		{
			return _terrainTileList;
		}

		public function set terrainTileList(value:Vector.<MapTerrainTileVO>):void
		{
			_terrainTileList = value;
		}

		/**
		 *最大跨越通行地形高度 
		 */
		public function get walkableHeight():int
		{
			return _walkableHeight;
		}

		/**
		 * @private
		 */
		public function set walkableHeight(value:int):void
		{
			_walkableHeight = value;
		}

		/**
		 *最大穿越通行地形高度 
		 */
		public function get walkableBottom():int
		{
			return _walkableBottom;
		}

		/**
		 * @private
		 */
		public function set walkableBottom(value:int):void
		{
			_walkableBottom = value;
		}


	}
}